<!doctype html>
<html>
<head>
	<title>扫描记录</title>
	<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
	<meta name="format-detection" content="telephone=no"/> <!--禁止数字串在ok手机中被识别成电话号码-->
	<meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
	<!-- ICO -->
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/css2/main.css" media="all" />
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/css2/style.css" media="all" />
	<!-- iconfont图形样式 -->
	<link rel="stylesheet" href="__PUBLIC__/css2/iconfont/iconfont.css" type="text/css">
</head>
	<style type="text/css">
	.main{padding-bottom: 2px;}
	.bill-list{height: 80px;margin: 10px 0 20px 0;}
  body{background: #EEEEEE;}
	</style>
<body>
<!--header页头文件-->


<div class="main pay">
	<dl>
    <dt><label>{$shopname}</label></dt>
		<dt><label>已扫描</label><strong>&emsp;&emsp;{$scan}</strong></dt>
        <dt><label>未扫描</label><strong>&emsp;&emsp;{$not_scan}</strong></dt>
	</dl>
	<ul class="pay_qd">
		<volist name="list" id="vo">
			<li>
				<a href="" onclick="return false;">
					<span class="left">
						<label>{$vo.name}</label>
						<p>{$vo.add_time|default=''|date='Y-m-d H:i:s',###}</p>
					</span>
					<strong class="right">{$vo.area}</strong>
				</a>
			</li>
		</volist>
	</ul>
</div>
<div class="main pay" id="xm_zc"></div>
	<script id="script-model" type="text/x-dot-template">
	{{ for (var i = 0; i < it.length; i++){ }}
	<ul class="pay_qd">
		<li>
			<a href='' onclick="return false;">
				<span class="left">
					<label>{{=it[i].name}}</label>
					<p>{{= func_date(it[i].add_time) }}</p>
				</span>
				<strong class="right">{{=it[i].area}}</strong>
			</a>
		</li>
	</ul>
	{{ } }}
	</script>
<div id="yemx" class="bill-list" align="center"><if condition='$list eq null'>没有数据<else />向上拖动加载更多……</if></div>
<!--footer底部文件-->
<include file="Base/footer" />
<script src="__PUBLIC__/js/jquery-1.10.1.min.js" type="text/javascript"></script>
<script src="__PUBLIC__/js/doT.min.js"></script>
<script src="__PUBLIC__/plugins/layer/layer.min.js"></script>
<script type="text/javascript">
   var i=1;
   var bool=true
   $(window).scroll( function(){
          if (!bool) return false;
            var scrollTop = 0;
            var clientHeight = 0;
            var scrollHeight = 0;
            var replaceAppNo=$("input[name='replaceAppNo']" ).val();
            if (document.documentElement && document.documentElement.scrollTop) {
                scrollTop = document.documentElement.scrollTop;
            } else if (document.body) {
                scrollTop = document.body.scrollTop;
            }
            if (document.body.clientHeight && document.documentElement.clientHeight) {
                clientHeight = (document.body.clientHeight < document.documentElement.clientHeight) ? document.body.clientHeight: document.documentElement.clientHeight;
            } else {
                clientHeight = (document.body.clientHeight > document.documentElement.clientHeight) ? document.body.clientHeight: document.documentElement.clientHeight;
            }
            scrollHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
            if (scrollTop + clientHeight == scrollHeight) {
                      //do something
                      var index = layer.load(1, {
              shade: [0.5,'#fff'] //0.1透明度的白色背景
            });
                      i++;
                      $.ajax({
                        url:"{:U('Scan/index')}",
                        type:"post",
                        data:{'page':i},
                        success:function(data){
                          if (data!="") {
                             console.log(JSON.stringify(data))
                             layer.close(index);
                             $('#xm_zc').append(doT.template($('#script-model').text())(data));
                            }else{
                               $("#yemx").addClass('disabled').text("全部数据");
                               layer.close(index);
                                   bool=false;
                            }
                        }
                      })
                }
    });

  //json长度获取
  function getLength(json) {
      var Length = 0;
      for (var item in json) {
        Length++;
      }
      return Length;
    }
    function func_date(time){
          // return "aa";
          var date=new Date(parseInt(time)*1000);
          var year=date.getFullYear();  // 获取完整的年份(4位,1970)
          var month=date.getMonth()+1;  // 获取月份(0-11,0代表1月,用的时候记得加上1)
          var day=date.getDate();    //获取日
          return year+"-"+month+"-"+day;
    }
</script>